<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        // var reg = /(\d{2})\1/;
        // var s = "1313";

        // console.log(reg.test(s));

        var s = "aaaaaaaabbbbbbbbbccccccdefgggggggg";
        //找出该字符串中连续的字符
        var reg = /(?<char>\w)\k<char>+/g;
        while (result = reg.exec(s)) {
            console.log(result[1]);
        }
    </script>
</body>

</html>
